package com.cskaoyan.bean.goods.wxbean;

import com.github.pagehelper.PageInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
//@AllArgsConstructor
public class DuBaseData<T,K> {


    private int total;
    private int pages;
    private int limit;
    private int page;
    private List<T> list1;
    private List<K> list2;

    public DuBaseData(int total, int pages, int limit, int page, List<T> list1,List<K> list2) {
        this.total = total;
        this.pages = pages;
        this.limit = limit;
        this.page = page;
        this.list1 = list1;
        this.list2 = list2;
    }

    public DuBaseData(PageInfo<T> pageInfo, List<T> list1,List<K> list2) {
        long total = pageInfo.getTotal();
        int pages = pageInfo.getPages();
        int pageNum = pageInfo.getPageNum();
        this.total = (int) total;
        this.pages = pages;
        this.limit = pageInfo.getPageSize();
        this.page = pageNum;
        this.list1 = list1;
        this.list2 = list2;
    }
}
